﻿package com.dg.gaming.api.common.playerstate
{
	import com.dg.gaming.api.common.Game;
	import com.dg.gaming.api.common.Table;

	/**
	 * ...
	 * @author
	 */
	public class PlayerState
	{

		// Integer constrants

		/** Player is simply viewing a table. */
		public static const VIEWING:String="viewing";

		/** Player is seated at a table. */
		public static const SEATED:String="seated";

		/** Player is ready to start a table. */
		public static const READY_TO_START:String="ready";

		/** Player is in the middle of a game at a table. */
		public static const GAME_STARTED:String="started";

		/**
		 * Abstract method which defines what a player can do when they sit.
		 *
		 * @return PlayerState object.
		 */
		public function sit():PlayerState
		{
			return null;
		}

		/**
		 * Abstract method which defines what a player can do when they stand up.
		 *
		 * @return PlayerState object.
		 */
		public function stand():PlayerState
		{
			return null;
		}

		/**
		 * Abstract method which defines what a player can do when they start.
		 *
		 * @return PlayerState object.
		 */
		public function start():PlayerState
		{
			return null;
		}

		// The following 3 methods are not abstract and return false by default

		/**
		 * Returns true if a user can sit.
		 *
		 * @param table    Link to the table
		 * @return         True if player can sit down.
		 */
		public function canSit(table:Table):Boolean
		{
			return false;
		}

		/**
		 * Returns true if a user can stand.
		 *
		 * @param table    Link to the table
		 * @return         True if player can stand up.
		 */
		public function canStand(table:Table):Boolean
		{
			return false;
		}

		/**
		 * Returns true if a user can hit the start.
		 *
		 * @param table    Link to the table
		 * @param game     Link to the game.
		 * @return         True if player can start.
		 */
		public function canStart(table:Table, game:Game):Boolean
		{
			return false;
		}

		/**
		 * Returns true if a user can offer a draw or resign.
		 * @return         True if player offer a draw or resign.
		 */
		public function canOfferDrawResign():Boolean
		{
			return false;
		}

		/**
		 * Integer label of this state (see constants of this class).
		 *
		 * @return          String value of this state.
		 */
		public function stringValue():String
		{
			return null;
		}

		public function toString():String
		{
			return null;
		}

	}

}